package com.dpmc.jms;

import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.ejb.ActivationConfigProperty;
import javax.ejb.MessageDriven;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.TextMessage;

import com.common.util.ObjectUtils;
import com.core.service.AppBaseService;
import com.core.service.ServiceInterface;
import com.dpmc.entity.TB_SHGL_SHFJ;
import com.dpmc.entity.TB_SHGL_SHJBXX;
import com.dpmc.entity.TB_SHGL_XXFBDL;

/**
 * 生成网页内容
 *
 */
@MessageDriven(activationConfig={
		@ActivationConfigProperty(propertyName="destinationType",propertyValue="javax.jms.Queue"),
		@ActivationConfigProperty(propertyName="destination",propertyValue="ReleaseShxxQueue")
	})
public class JMB_RELEASE_SHXX  extends AppBaseService implements MessageListener {
 
	 
    public void onMessage(Message message) { 
    	TextMessage tm = (TextMessage)message;
		String content="";;
		try {
			content = tm.getText();
		
		} catch (JMSException e1) { 
			e1.printStackTrace();
			
		} 
		Map param =ObjectUtils.jsonToMap(content);  
	 
		Map m_fbdl  = null;
    	try { 
			String sOptime = (String)param.get(ServiceInterface.SYSPARAM_SSO_OPTIME);
			Date optime = ObjectUtils.getUtilDate(sOptime, ObjectUtils.TRANSPORT_DATE_FORMAT); 
			param.put(ServiceInterface.SYSPARAM_SSO_OPTIME, optime);
			
			StringBuffer hql = new StringBuffer();
			hql.append("select new map (o.ID as ID) from TB_SHGL_XXFBDL o");
			hql.append(" where o.STATUS=0");
			hql.append(" and o.SHID='").append(param.get("ID")).append("'");
			m_fbdl = (Map) querySingleResult(hql.toString()); 
			m_fbdl.put("END_TIME",new Date()); 
		   
		    copySysParam( param, m_fbdl);
			 
		 	fb((String)param.get("ID"),param);  
		    
		    
			String next_svc = (String) param.get("next_svc");
			String next_svc_oper = (String) param.get("next_svc_oper");
		 
			if(next_svc!=null && !next_svc.isEmpty() && next_svc_oper!=null && !next_svc_oper.isEmpty()){
			 
				getServiceInterface().doService(next_svc, next_svc_oper, param);
			} 
			 
			m_fbdl.put("STATUS", 1); 
		
		}  catch(Exception e) {
		
			HashMap lockParam = new HashMap();
            lockParam.put("ID", param.get("ID"));
            TB_SHGL_SHJBXX shjbxx_po =getJpaDao().find(TB_SHGL_SHJBXX.class, (String) param.get("ID"));  
            lockParam.put("STATUS", -(shjbxx_po.getSTATUS()+10));
            copySysParam( param, lockParam);
			getServiceInterface().doService("SVC_SHGL", "UPD_SHJBXX_STATUS_NO_WF", param); 
			
			m_fbdl.put("STATUS", -1);
			m_fbdl.put("MESSAGE", e.getMessage());
			
	 
		} finally{
			getServiceInterface().doService("SVC_SHGL", "UPD_XXFBDL", m_fbdl); 
		}
    }
    private String fmtValue(Object v){
    	if(v!=null&&!((String)v).isEmpty()){
    		return ((String)v).trim();
    	}
    	return null;
    }
    private void ws(Map param,Date optime){
    	String CMS_WS_URL = (String) param.get("CMS_WS_URL");
		String path_date = ObjectUtils.dateToString(optime, "yyyyMMdd");
		Map<String,Object> inParam = new HashMap<String,Object>();
		TB_SHGL_SHJBXX shjbxx =  ObjectUtils.mapToJavaBean(param, TB_SHGL_SHJBXX.class);  
		Map<String,Object> queryParam = new HashMap<String,Object>();
		queryParam.put("SHID", shjbxx.getID());
		//对象——商户基本信息  
		Map JBXX = (Map) querySingleResult("Q_SHGL_WS.GET_TB_SHGL_JBXX_BY_SHID",queryParam); 
		if(JBXX.get("HTML_FILE_PATH")!=null){
			getServiceInterface().doWebService(CMS_WS_URL, "deleteFile", (String)JBXX.get("HTML_FILE_PATH"));
		}
		TB_SHGL_SHJBXX po_JBXX =getJpaDao().find(TB_SHGL_SHJBXX.class, shjbxx.getID()); 
		po_JBXX.setHTML_FILE_PATH("html/"+po_JBXX.getHYFLID()+"/"+path_date+"/"+po_JBXX.getID()+".html");
		getJpaDao().update(po_JBXX); 
		JBXX.put("HTML_FILE_PATH", po_JBXX.getHTML_FILE_PATH());
		inParam.put("OBJ_SHJBXX", JBXX);   
		
	 	//列表——商户扩展信息  
		List kzsxList =getResultList("Q_SHGL_WS.GET_TB_SHGL_KZSXZ_BY_SHID", queryParam);
		inParam.put("LIST_KZXX", kzsxList); 
		
		//列表——商户门面图片  
		List<Map> images =(List<Map>) getResultList("Q_SHGL_WS.GET_TB_SHGL_SHMM_BY_SHID", queryParam);
		for(Map item:images){
			xgfj(CMS_WS_URL,"upload/images/shxx/"+path_date,item);
		}
		inParam.put("LIST_SHMM", images); 
		
		//列表—— 商品信息
		List<Map> spxxList = (List<Map>) getResultList( "Q_SHGL_WS.GET_TB_SHGL_SPXX_BY_SHID", queryParam);
		for(Map item:spxxList){
			queryParam.put("SPID", item.get("ID"));
			// 列表——商品扩展信息
			item.put("LIST_KZXX", getResultList( "Q_SHGL_WS.GET_SPGL_SPXX_SXZ_BY_SPID", queryParam));
			// 列表——商品图片 
		    List<Map> sp_images =(List<Map>) getResultList( "Q_SHGL_WS.GET_SPGL_SPXX_SPTP_BY_SPID", queryParam);
			for(Map sp_item:sp_images){
				xgfj(CMS_WS_URL,"upload/images/spxx/"+path_date,sp_item);
			}
			item.put("LIST_SPTP",sp_images );
		}
		inParam.put("LIST_SPXX", spxxList); 
		
		//列表—— 周边交通
		List zbjtList = getResultList("Q_SHGL_WS.GET_TB_SHGL_ZBJT_BY_SHID", queryParam);  
		inParam.put("LIST_ZBJT", zbjtList);   
		
		getServiceInterface().doWebService(CMS_WS_URL, "releaseInfo",ObjectUtils.objectToJson(inParam));
    }
    
    private void xgfj(String CMS_WS_URL,String path_root,Map item){
		String path = (String) item.get("PATH");
		Map TB_UFM_UPLOADFILE = (Map) getServiceInterface().doService("SVC_UPLOADFILE", "GET_FILE_BY_ID", item.get("FILE_ID"));
		if(path!=null) {
			getServiceInterface().doWebService(CMS_WS_URL, "deleteFile", path);
		}
		path=path_root+"/"+item.get("FILE_ID")+TB_UFM_UPLOADFILE.get("EXT_NAME"); 
		getServiceInterface().doWebService(CMS_WS_URL, "releaseImage", path, TB_UFM_UPLOADFILE.get("FILE_BODY"));
		
		TB_SHGL_SHFJ shfj =  getJpaDao().find(TB_SHGL_SHFJ.class, (String)item.get("ID")); 
		shfj.setFILE_PATH(path) ;
		getJpaDao().update(shfj);
	}
    private void fb_jd(String  id,Map param,Map JBXX){
    	HashMap queryParam =new HashMap();
    	queryParam.put("SHID", id); 
    	Date optime = getOpTime(param);
    	String path_date = ObjectUtils.dateToString(optime, "yyyyMMdd");
    	String image_path = "images/shxx/"+path_date+"/";
    	List<Map> images=new ArrayList<Map>();
    	HashMap bo =new HashMap(); 
		copySysParam(param, bo);
		bo.put("ID", id);
		bo.put("SHMC", JBXX.get("SJMC"));
		bo.put("SHDZ", JBXX.get("XXDZ"));
		bo.put("SHJJ", JBXX.get("SHJJ"));  
		bo.put("TJDJ", JBXX.get("TJDJ"));
		bo.put("DQBM", JBXX.get("DQBM"));  
		
	 	//列表——商户扩展信息  
		List<Map> kzsxList =(List<Map>) getResultList("Q_SHGL_WS.GET_TB_SHGL_KZSXZ_BY_SHID", queryParam);  
		 
		for(Map item: kzsxList){
			if("JD_QTDH".equals(item.get("LXDY_KZSXID"))){
				bo.put("QTDH", item.get("SXZ")); 
			}else if("JD_FJSL".equals(item.get("LXDY_KZSXID"))){
				bo.put("FJSL", item.get("SXZ")); 
			}else if("JD_JDRS".equals(item.get("LXDY_KZSXID"))){
				bo.put("JDRS", item.get("SXZ")); 
			}else if("JD_XJ".equals(item.get("LXDY_KZSXID"))){
				bo.put("XJ", item.get("SXZ")); 
			} else if("JD_JSSS".equals(item.get("LXDY_KZSXID"))){
				if(item.get("SXZ")!=null){
					String sxz = (String)item.get("SXZ");
					if(sxz!=null){
						Map value = getValueMap(sxz); 
						bo.put("JSSS_1", fmtValue(value.get("舞厅")));  
						bo.put("JSSS_2", fmtValue(value.get("KTV")));  
						bo.put("JSSS_3", fmtValue(value.get("棋牌室")));  
						bo.put("JSSS_4", fmtValue(value.get("桌球室")));  
						bo.put("JSSS_5", fmtValue(value.get("乒乓球室")));  
						bo.put("JSSS_6", fmtValue(value.get("健身房")));  
						bo.put("JSSS_7", fmtValue(value.get("按摩室")));  
						bo.put("JSSS_8", fmtValue(value.get("足浴")));  
						bo.put("JSSS_9", fmtValue(value.get("SPA")));  
						bo.put("JSSS_10", fmtValue(value.get("网球场")));  
						bo.put("JSSS_11", fmtValue(value.get("游泳池")));  
						bo.put("JSSS_QT", fmtValue(value.get("其他")));  
					}
				}
				
			}else if("JD_CYSS".equals(item.get("LXDY_KZSXID"))){
				if(item.get("SXZ")!=null){
					String sxz = (String)item.get("SXZ");
					if(sxz!=null){
						Map value = getValueMap(sxz); 
						bo.put("CYSS_1", fmtValue(value.get("中餐厅")));  
						bo.put("CYSS_2", fmtValue(value.get("西餐厅")));  
						bo.put("CYSS_3", fmtValue(value.get("咖啡厅")));  
						bo.put("CYSS_4", fmtValue(value.get("酒吧")));  
						bo.put("CYSS_5", fmtValue(value.get("茶室")));  
						bo.put("CYSS_6", fmtValue(value.get("大堂吧")));  
						bo.put("CYSS_7", fmtValue(value.get("烧烤")));  
						bo.put("CYSS_8", fmtValue(value.get("限时送餐服务")));  
						bo.put("CYSS_9", fmtValue(value.get("全天送餐服务 ")));  
						bo.put("CYSS_QT", fmtValue(value.get("其他")));  
					}
				}
			}else if("JD_FWXM".equals(item.get("LXDY_KZSXID"))){
				if(item.get("SXZ")!=null){
					String sxz = (String)item.get("SXZ");
					if(sxz!=null){
						Map value = getValueMap(sxz); 
						bo.put("FWXM_1", fmtValue(value.get("会议厅")));  
						bo.put("FWXM_2", fmtValue(value.get("公共区域无线上网")));  
						bo.put("FWXM_3", fmtValue(value.get("接机服务")));  
						bo.put("FWXM_4", fmtValue(value.get("邮政服务")));  
						bo.put("FWXM_5", fmtValue(value.get("外币兑换服务")));  
						bo.put("FWXM_6", fmtValue(value.get("贵重物品保险柜")));  
						bo.put("FWXM_7", fmtValue(value.get("免费旅游交通图")));  
						bo.put("FWXM_8", fmtValue(value.get("商场票务服务")));  
						bo.put("FWXM_9", fmtValue(value.get("专职行李员")));  
						bo.put("FWXM_10", fmtValue(value.get("行李存放服务")));  
						bo.put("FWXM_11", fmtValue(value.get("洗衣服务")));  
						bo.put("FWXM_12", fmtValue(value.get("叫醒服务")));  
						bo.put("FWXM_TSFW", fmtValue(value.get("特色服务")));  
					}
				}
			} 
		}
		//列表——商户门面图片  
		List<Map> LIST_SHMM =(List<Map>) getResultList("Q_SHGL_WS.GET_TB_SHGL_SHMM_BY_SHID", queryParam);  
		List LIST_TP = new ArrayList();
		bo.put("LIST_TP", LIST_TP);
		for(Map item :LIST_SHMM){
			HashMap o =new HashMap();
			o.put("ID", item.get("ID"));
			o.put("JDID", bo.get("ID"));
			o.put("SFJTP","0");
			o.put("XH",item.get("XH")); 
			o.put("TPSM",item.get("FILE_INFO")); 
			
			Map image =new HashMap();
			Map TB_UFM_UPLOADFILE = (Map) getServiceInterface().doService("SVC_UPLOADFILE", "GET_FILE_BY_ID", item.get("FILE_ID"));
		  
			o.put("TPLX", TB_UFM_UPLOADFILE.get("EXT_NAME"));
			o.put("TPID", item.get("FILE_ID"));
			o.put("TPML", image_path+JBXX.get("HYFLID"));
			
			image.put("ML", image_path+JBXX.get("HYFLID"));  
			image.put("LX", TB_UFM_UPLOADFILE.get("EXT_NAME"));
			image.put("ID", item.get("FILE_ID"));
			image.put("data", TB_UFM_UPLOADFILE.get("FILE_BODY"));
    		images.add(image); 
			LIST_TP.add(o); 
			
			//门面图片 
			if(item.get("FILE_ID")!=null&&item.get("FILE_ID").equals(JBXX.get("FILE_ID"))){ 
				bo.put("MMTP_LX", TB_UFM_UPLOADFILE.get("EXT_NAME"));
				bo.put("MMTP_ID", JBXX.get("FILE_ID"));
				bo.put("MMTP_ML", image_path+JBXX.get("HYFLID"));
			} 
		}
		// 列表——商品图片 
	    List<Map> sp_images =(List<Map>) getResultList( "Q_SHGL_WS.GET_SPGL_SPXX_SPTP_BY_SPID", queryParam); 
	    for(Map item :sp_images){
			HashMap o =new HashMap();
			o.put("ID", item.get("ID"));
			o.put("JDID", bo.get("ID"));
			o.put("SFJTP","1");
			o.put("FJID",item.get("LINK_ID"));
			o.put("XH",item.get("XH"));
			o.put("TPSM",item.get("FILE_INFO")); 
			
			Map image =new HashMap();
			Map TB_UFM_UPLOADFILE = (Map) getServiceInterface().doService("SVC_UPLOADFILE", "GET_FILE_BY_ID", item.get("FILE_ID"));
		  
			o.put("TPLX", TB_UFM_UPLOADFILE.get("EXT_NAME"));
			o.put("TPID", item.get("FILE_ID"));
			o.put("TPML", image_path+JBXX.get("HYFLID"));
			
			image.put("ML", image_path+JBXX.get("HYFLID"));  
			image.put("LX", TB_UFM_UPLOADFILE.get("EXT_NAME"));
			image.put("ID", item.get("FILE_ID"));
			image.put("data", TB_UFM_UPLOADFILE.get("FILE_BODY"));
    		images.add(image); 
			LIST_TP.add(o);
		}
		
		
		//列表—— 商品信息
		List<Map> spxxList = (List<Map>) getResultList( "Q_SHGL_WS.GET_TB_SHGL_SPXX_BY_SHID", queryParam);
		List<Map> LIST_FJ = new ArrayList();
		bo.put("LIST_FJ", LIST_FJ);
		for(Map item:spxxList){ 
			HashMap o = new HashMap();
			o.put("ID", item.get("ID"));
			o.put("JDID", bo.get("ID"));
			o.put("FX", item.get("SPMC"));
			o.put("FXJS", item.get("SPJS"));
			o.put("MSJ", item.get("MSJ"));
			o.put("HYJ", item.get("XYJ"));
			o.put("ZK", item.get("HYZK"));
			
			
			// 列表——商品扩展信息
			queryParam.put("SPID", item.get("ID"));
			List<Map> LIST_KZXX =  (List<Map>) getResultList( "Q_SHGL_WS.GET_SPGL_SPXX_SXZ_BY_SPID", queryParam);
			for(Map kzxx:LIST_KZXX){
				if("床型	".equals(kzxx.get("SXMC"))){
					o.put("CX", fmtValue(kzxx.get("SXZ")));
				}else if("早餐".equals(kzxx.get("SXMC"))){
					o.put("ZC", fmtValue(kzxx.get("SXZ")));
				}else if("宽带".equals(kzxx.get("SXMC"))){
					o.put("KD", fmtValue(kzxx.get("SXZ")));
				}
			} 
			LIST_FJ.add(o); 
		}
		 
		//列表—— 周边交通 
		List<Map> JTFSList = (List<Map>) getResultList(  "SELECT new map(NAME AS NAME,CODE AS CODE) FROM TB_SYS_SJZD WHERE TYPE='TB_SHGL_ZBJT.JTFS'"); 
		Map cacheJTFS=new HashMap();
		for(Map item: JTFSList){
			cacheJTFS.put(item.get("CODE"), item.get("NAME"));
		}
		List<Map> QSDDList = (List<Map>) getResultList(  "SELECT new map(NAME AS NAME,CODE AS CODE) FROM TB_SYS_SJZD WHERE TYPE='TB_SHGL_ZBJT.QSDD'");
		Map cacheQSDD=new HashMap();
		for(Map item: QSDDList){
			cacheQSDD.put(item.get("CODE"), item.get("NAME"));
		}
		List<Map> LIST_ZBJT = new ArrayList<Map>();
		bo.put("LIST_ZBJT", LIST_ZBJT);
		List<Map> zbjtList = (List<Map>) getResultList(  "Q_SHGL_WS.GET_TB_SHGL_ZBJT_BY_SHID", queryParam);  
		for(Map item:zbjtList){ 
			HashMap o = new HashMap();
			o.put("ID", item.get("ID"));
			o.put("JDID", bo.get("ID"));
			o.put("QSDD", cacheQSDD.get(item.get("QSDD")));
			o.put("JTFS", cacheJTFS.get(item.get("JTFS")));
			o.put("XL", item.get("XL"));
			o.put("SJ", item.get("SJ"));  
		 
			LIST_ZBJT.add(o); 
		}
	
	
		getServiceInterface().doService("SVC_RES", "SAVE_JD", bo);
		
		for(Map item:images){ 
			getServiceInterface().doService("SVC_RES", "SAVE_IMAGE", item.get("ML"), item.get("ID") , item.get("LX"), item.get("data"));
		}
		
    }
    //餐饮
    private void fb_cy(String  id,Map param,Map JBXX){
    	HashMap queryParam =new HashMap();
    	queryParam.put("SHID", id); 
    	Date optime = getOpTime(param);
    	String path_date = ObjectUtils.dateToString(optime, "yyyyMMdd");
    	String image_path = "images/shxx/"+path_date+"/";
    	List<Map> images=new ArrayList<Map>();
    	HashMap bo =new HashMap(); 
		copySysParam(param, bo);
		bo.put("ID", id);
		bo.put("SHMC", JBXX.get("SJMC"));
		bo.put("SHDZ", JBXX.get("XXDZ"));
		bo.put("SHJJ", JBXX.get("SHJJ"));  
		bo.put("TJDJ", JBXX.get("TJDJ"));
		bo.put("DQBM", JBXX.get("DQBM"));  
		
		
	 	//列表——商户扩展信息  
		List<Map> kzsxList =(List<Map>) getResultList("Q_SHGL_WS.GET_TB_SHGL_KZSXZ_BY_SHID", queryParam);  
		 
		for(Map item: kzsxList){
			if("CY_QTDH".equals(item.get("LXDY_KZSXID"))){
				bo.put("QTDH", fmtValue(item.get("SXZ"))); 
			}else if("CY_CZSL".equals(item.get("LXDY_KZSXID"))){
				bo.put("CZSL", fmtValue(item.get("SXZ"))); 
			}else if("CY_JDRS".equals(item.get("LXDY_KZSXID"))){
				bo.put("JDRS", fmtValue(item.get("SXZ"))); 
			}else if("CY_ZYCX".equals(item.get("LXDY_KZSXID"))){
				bo.put("ZYCX", fmtValue(item.get("SXZ"))); 
			} else if("CY_YYSJ".equals(item.get("LXDY_KZSXID"))){
				bo.put("YYSJ", fmtValue(item.get("SXZ"))); 
			}else if("CY_ZYSX".equals(item.get("LXDY_KZSXID"))){
				bo.put("ZYSX", fmtValue(item.get("SXZ"))); 
			}else if("CY_MD".equals(item.get("LXDY_KZSXID"))){
				if(item.get("SXZ")!=null){
					String sxz = (String)item.get("SXZ");
					if(sxz!=null){
						Map value = getValueMap(sxz); 
						bo.put("MD_1", fmtValue(value.get("商务宴请")));  
						bo.put("MD_2", fmtValue(value.get("情侣约会")));  
						bo.put("MD_3", fmtValue(value.get("家庭聚会")));  
						bo.put("MD_4", fmtValue(value.get("特色品味")));  
						bo.put("MD_5", fmtValue(value.get("朋友同事聚餐")));  
						bo.put("MD_6", fmtValue(value.get("婚庆喜宴 ")));    
						bo.put("MD_QT", fmtValue(value.get("其他 ")));  
					}
				}
				
			}else if("CY_QTSSJFW".equals(item.get("LXDY_KZSXID"))){
				if(item.get("SXZ")!=null){
					String sxz = (String)item.get("SXZ");
					if(sxz!=null){
						Map value = getValueMap(sxz); 
						bo.put("QTSSJFW_1", fmtValue(value.get("停车场")));  
						bo.put("QTSSJFW_2", fmtValue(value.get("带客泊车")));  
						bo.put("QTSSJFW_3", fmtValue(value.get("包间")));  
						bo.put("QTSSJFW_QTBY", fmtValue(value.get("其他表演")));  
						bo.put("QTSSJFW_QTSS", fmtValue(value.get("其他设施")));  
						bo.put("QTSSJFW_QTFW", fmtValue(value.get("其他服务")));   
					}
				}
			}  
		}
		//列表——商户门面图片  
		List<Map> LIST_SHMM =(List<Map>) getResultList("Q_SHGL_WS.GET_TB_SHGL_SHMM_BY_SHID", queryParam);  
		List LIST_TP = new ArrayList();
		bo.put("LIST_TP", LIST_TP);
		for(Map item :LIST_SHMM){
			HashMap o =new HashMap();
			o.put("ID", item.get("ID"));
			o.put("CYID", bo.get("ID"));
			o.put("SCPTP","0");
			o.put("XH",item.get("XH")); 
			o.put("TPSM",item.get("FILE_INFO")); 
			
			Map image =new HashMap();
			Map TB_UFM_UPLOADFILE = (Map) getServiceInterface().doService("SVC_UPLOADFILE", "GET_FILE_BY_ID", item.get("FILE_ID"));
		  
			o.put("TPLX", TB_UFM_UPLOADFILE.get("EXT_NAME"));
			o.put("TPID", item.get("FILE_ID"));
			o.put("TPML", image_path+JBXX.get("HYFLID"));
			
			image.put("ML", image_path+JBXX.get("HYFLID"));  
			image.put("LX", TB_UFM_UPLOADFILE.get("EXT_NAME"));
			image.put("ID", item.get("FILE_ID"));
			image.put("data", TB_UFM_UPLOADFILE.get("FILE_BODY"));
    		images.add(image); 
			LIST_TP.add(o);
			
			//门面图片 
			if(item.get("FILE_ID")!=null&&item.get("FILE_ID").equals(JBXX.get("FILE_ID"))){ 
				bo.put("MMTP_LX", TB_UFM_UPLOADFILE.get("EXT_NAME"));
				bo.put("MMTP_ID", JBXX.get("FILE_ID"));
				bo.put("MMTP_ML", image_path+JBXX.get("HYFLID"));
			} 
		}
		// 列表——商品图片 
	    List<Map> sp_images =(List<Map>) getResultList( "Q_SHGL_WS.GET_SPGL_SPXX_SPTP_BY_SPID", queryParam); 
	    for(Map item :sp_images){
			HashMap o =new HashMap();
			o.put("ID", item.get("ID"));
			o.put("CYID", bo.get("ID"));
			o.put("SCPTP","1");
			o.put("CPID",item.get("LINK_ID"));
			o.put("XH",item.get("XH")); 
			o.put("TPSM",item.get("FILE_INFO")); 
			
			Map image =new HashMap();
			Map TB_UFM_UPLOADFILE = (Map) getServiceInterface().doService("SVC_UPLOADFILE", "GET_FILE_BY_ID", item.get("FILE_ID"));
		  
			o.put("TPLX", TB_UFM_UPLOADFILE.get("EXT_NAME"));
			o.put("TPID", item.get("FILE_ID"));
			o.put("TPML", image_path+JBXX.get("HYFLID"));
			
			image.put("ML", image_path+JBXX.get("HYFLID"));  
			image.put("LX", TB_UFM_UPLOADFILE.get("EXT_NAME"));
			image.put("ID", item.get("FILE_ID"));
			image.put("data", TB_UFM_UPLOADFILE.get("FILE_BODY"));
    		images.add(image); 
			LIST_TP.add(o); 
			
		}
		
		
		//列表—— 商品信息
		List<Map> spxxList = (List<Map>) getResultList( "Q_SHGL_WS.GET_TB_SHGL_SPXX_BY_SHID", queryParam);
		List<Map> LIST_CP = new ArrayList();
		bo.put("LIST_CP", LIST_CP);
		for(Map item:spxxList){ 
			HashMap o = new HashMap();
			o.put("ID", item.get("ID"));
			o.put("CYID", bo.get("ID"));
			o.put("CPMC", item.get("SPMC"));
			o.put("JTJS", item.get("SPJS"));
			o.put("MSJ", item.get("MSJ"));
			o.put("HYJ", item.get("XYJ"));
			o.put("ZK", item.get("HYZK"));  
			 
			LIST_CP.add(o); 
		}
		 
		//列表—— 周边交通 
		List<Map> JTFSList = (List<Map>) getResultList(  "SELECT new map(NAME AS NAME,CODE AS CODE) FROM TB_SYS_SJZD WHERE TYPE='TB_SHGL_ZBJT.JTFS'"); 
		Map cacheJTFS=new HashMap();
		for(Map item: JTFSList){
			cacheJTFS.put(item.get("CODE"), item.get("NAME"));
		}
		List<Map> QSDDList = (List<Map>) getResultList(  "SELECT new map(NAME AS NAME,CODE AS CODE) FROM TB_SYS_SJZD WHERE TYPE='TB_SHGL_ZBJT.QSDD'");
		Map cacheQSDD=new HashMap();
		for(Map item: QSDDList){
			cacheQSDD.put(item.get("CODE"), item.get("NAME"));
		}
		List<Map> LIST_ZBJT = new ArrayList<Map>();
		bo.put("LIST_ZBJT", LIST_ZBJT);
		List<Map> zbjtList = (List<Map>) getResultList(  "Q_SHGL_WS.GET_TB_SHGL_ZBJT_BY_SHID", queryParam);  
		for(Map item:zbjtList){ 
			HashMap o = new HashMap();
			o.put("ID", item.get("ID"));
			o.put("CYID", bo.get("ID"));
			o.put("QSDD", cacheQSDD.get(item.get("QSDD")));
			o.put("JTFS", cacheJTFS.get(item.get("JTFS")));
			o.put("XL", item.get("XL"));
			o.put("SJ", item.get("SJ"));  
		 
			LIST_ZBJT.add(o); 
		} 
	
		getServiceInterface().doService("SVC_RES", "SAVE_CY", bo);
		
		for(Map item:images){ 
			getServiceInterface().doService("SVC_RES", "SAVE_IMAGE", item.get("ML"), item.get("ID") , item.get("LX"), item.get("data"));
		}
    }
  //租车行
    private void fb_zch(String  id,Map param,Map JBXX){
    	HashMap queryParam =new HashMap();
    	queryParam.put("SHID", id); 
    	Date optime = getOpTime(param);
    	String path_date = ObjectUtils.dateToString(optime, "yyyyMMdd");
    	String image_path = "images/shxx/"+path_date+"/";
    	List<Map> images=new ArrayList<Map>();
    	HashMap bo =new HashMap(); 
		copySysParam(param, bo);
		bo.put("ID", id);
		bo.put("ZCHMC", JBXX.get("SJMC"));
		bo.put("ZCHDZ", JBXX.get("XXDZ"));
		bo.put("ZCHJJ", JBXX.get("SHJJ"));  
		bo.put("TJDJ", JBXX.get("TJDJ"));
		bo.put("DQBM", JBXX.get("DQBM"));  
		
	 	//列表——商户扩展信息  
		List<Map> kzsxList =(List<Map>) getResultList("Q_SHGL_WS.GET_TB_SHGL_KZSXZ_BY_SHID", queryParam);   
		for(Map item: kzsxList){
			if("ZCH_QTDH".equals(item.get("LXDY_KZSXID"))){
				bo.put("QTDH", fmtValue(item.get("SXZ"))); 
			}else if("ZCH_ZCLC".equals(item.get("LXDY_KZSXID"))){
				bo.put("ZCLC", fmtValue(item.get("SXZ"))); 
			}else if("ZCH_HCLC".equals(item.get("LXDY_KZSXID"))){
				bo.put("HCLC", fmtValue(item.get("SXZ"))); 
			}else if("ZCH_ZCSXSM".equals(item.get("LXDY_KZSXID"))){
				bo.put("ZCSXSM", fmtValue(item.get("SXZ"))); 
			} else if("ZCH_ZZFW".equals(item.get("LXDY_KZSXID"))){
				queryParam.put("DXLBID", fmtValue(item.get("SXZ")));
				List<Map> dxsxzList =(List<Map>) getResultList("Q_SHGL_WS.GET_TB_SHGL_SHJBXX_KZSX_DXSXZ_BY_DXLBID", queryParam);    
				HashMap<Object,Map> tmpCache =new HashMap<Object,Map>(); 
				for(Map dxz : dxsxzList){
					Map obj=tmpCache.get(dxz.get("DXID"));
					if(obj==null){
						obj = new HashMap();
						tmpCache.put(dxz.get("DXID"), obj);
					} 
					obj.put(dxz.get("LXDY_KZSXID"), dxz.get("SXZ"));
				}
				List LIST_ZZFW = new ArrayList();
				bo.put("LIST_ZZFW", LIST_ZZFW);
				for(Map obj:tmpCache.values()){
					HashMap o =new HashMap();
					o.put("ZCHID", bo.get("ID")); 
					o.put("XH", obj.get("ZZFW_XH"));
					o.put("SM", obj.get("ZZFW_SM")); 
					
					LIST_ZZFW.add(o);
				} 
			}else if("ZCH_ZCZG".equals(item.get("LXDY_KZSXID"))){
				queryParam.put("DXLBID", item.get("SXZ"));
				List<Map> dxsxzList =(List<Map>) getResultList("Q_SHGL_WS.GET_TB_SHGL_SHJBXX_KZSX_DXSXZ_BY_DXLBID", queryParam);    
				HashMap<Object,Map> tmpCache =new HashMap<Object,Map>(); 
				for(Map dxz : dxsxzList){
					Map obj=tmpCache.get(dxz.get("DXID"));
					if(obj==null){
						obj = new HashMap();
						tmpCache.put(dxz.get("DXID"), obj);
					} 
					obj.put(dxz.get("LXDY_KZSXID"), dxz.get("SXZ"));
				}
				List LIST_ZCZG = new ArrayList();
				bo.put("LIST_ZCZG", LIST_ZCZG);
				for(Map obj:tmpCache.values()){
					HashMap o =new HashMap();
					o.put("ZCHID", bo.get("ID")); 
					o.put("XH", obj.get("ZCZG_XH"));
					o.put("SM", obj.get("ZCZG_SM")); 
					
					LIST_ZCZG.add(o);
				} 
			}
		}
		//列表——商户门面图片  
		List<Map> LIST_SHMM =(List<Map>) getResultList("Q_SHGL_WS.GET_TB_SHGL_SHMM_BY_SHID", queryParam);  
		List LIST_TP = new ArrayList();
		bo.put("LIST_TP", LIST_TP);
		for(Map item :LIST_SHMM){
			HashMap o =new HashMap();
			o.put("ID", item.get("ID"));
			o.put("ZCHID", bo.get("ID")); 
			o.put("SCXZJ","0");
			o.put("XH",item.get("XH")); 
			o.put("TPSM",item.get("FILE_INFO")); 
			
			Map image =new HashMap();
			Map TB_UFM_UPLOADFILE = (Map) getServiceInterface().doService("SVC_UPLOADFILE", "GET_FILE_BY_ID", item.get("FILE_ID"));
		  
			o.put("TPLX", TB_UFM_UPLOADFILE.get("EXT_NAME"));
			o.put("TPID", item.get("FILE_ID"));
			o.put("TPML", image_path+JBXX.get("HYFLID"));
			
			image.put("ML", image_path+JBXX.get("HYFLID"));  
			image.put("LX", TB_UFM_UPLOADFILE.get("EXT_NAME"));
			image.put("ID", item.get("FILE_ID"));
			image.put("data", TB_UFM_UPLOADFILE.get("FILE_BODY"));
    		images.add(image); 
			LIST_TP.add(o); 
			
			//门面图片 
			if(item.get("FILE_ID")!=null&&item.get("FILE_ID").equals(JBXX.get("FILE_ID"))){ 
				bo.put("MMTP_LX", TB_UFM_UPLOADFILE.get("EXT_NAME"));
				bo.put("MMTP_ID", JBXX.get("FILE_ID"));
				bo.put("MMTP_ML", image_path+JBXX.get("HYFLID"));
			} 
		}
		// 列表——商品图片 
	    List<Map> sp_images =(List<Map>) getResultList( "Q_SHGL_WS.GET_SPGL_SPXX_SPTP_BY_SPID", queryParam); 
	    for(Map item :sp_images){
			HashMap o =new HashMap();
			o.put("ID", item.get("ID"));
			o.put("ZCHID", bo.get("ID"));
			o.put("SCXZJ","1");
			o.put("CXZJID",item.get("LINK_ID"));
			o.put("XH",item.get("XH")); 
			o.put("TPSM",item.get("FILE_INFO")); 
			
			Map image =new HashMap();
			Map TB_UFM_UPLOADFILE = (Map) getServiceInterface().doService("SVC_UPLOADFILE", "GET_FILE_BY_ID", item.get("FILE_ID"));
		  
			o.put("TPLX", TB_UFM_UPLOADFILE.get("EXT_NAME"));
			o.put("TPID", item.get("FILE_ID"));
			o.put("TPML", image_path+JBXX.get("HYFLID"));
			
			image.put("ML", image_path+JBXX.get("HYFLID"));  
			image.put("LX", TB_UFM_UPLOADFILE.get("EXT_NAME"));
			image.put("ID", item.get("FILE_ID"));
			image.put("data", TB_UFM_UPLOADFILE.get("FILE_BODY"));
    		images.add(image); 
			LIST_TP.add(o); 
			
		} 
		
		//列表—— 商品信息
		List<Map> spxxList = (List<Map>) getResultList( "Q_SHGL_WS.GET_TB_SHGL_SPXX_BY_SHID", queryParam);
		List<Map> LIST_CXZJ = new ArrayList();
		bo.put("LIST_CXZJ", LIST_CXZJ);
		for(Map item:spxxList){ 
			HashMap o = new HashMap();
			o.put("ID", item.get("ID"));
			o.put("ZCHID", bo.get("ID"));
			o.put("CX", item.get("SPMC"));
			o.put("CXMS", item.get("SPJS"));
			o.put("MSJ", item.get("MSJ"));
			o.put("HYJ", item.get("XYJ"));
			o.put("ZK", item.get("HYZK")); 
			 
			LIST_CXZJ.add(o); 
		}  
		
		getServiceInterface().doService("SVC_RES", "SAVE_ZCH", bo);
		
		for(Map item:images){ 
			getServiceInterface().doService("SVC_RES", "SAVE_IMAGE", item.get("ML"), item.get("ID") , item.get("LX"), item.get("data"));
		}
    }
  //景区、景点
    private void fb_jqjd(String  id,Map param,Map JBXX){
    	HashMap queryParam =new HashMap();
    	queryParam.put("SHID", id); 
    	Date optime = getOpTime(param);
    	String path_date = ObjectUtils.dateToString(optime, "yyyyMMdd");
    	String image_path = "images/shxx/"+path_date+"/";
    	List<Map> images=new ArrayList<Map>();
    	HashMap bo =new HashMap(); 
		copySysParam(param, bo);
		bo.put("ID", id);
		bo.put("JQMC", JBXX.get("SJMC"));
		bo.put("JQDZ", JBXX.get("XXDZ"));
		bo.put("JQJJ", JBXX.get("SHJJ"));  
		bo.put("TJDJ", JBXX.get("TJDJ"));
		bo.put("DQBM", JBXX.get("DQBM"));  
		
	 	//列表——商户扩展信息  
		List<Map> kzsxList =(List<Map>) getResultList("Q_SHGL_WS.GET_TB_SHGL_KZSXZ_BY_SHID", queryParam);   
		for(Map item: kzsxList){
			if("JQJD_JQFJTSCYSM".equals(item.get("LXDY_KZSXID"))){
				bo.put("JQFJTSCYSM", fmtValue(item.get("SXZ"))); 
			}else if("JQJD_JQFJZSTJSM".equals(item.get("LXDY_KZSXID"))){
				bo.put("JQFJZSTJSM", fmtValue(item.get("SXZ"))); 
			} else if("JQJD_JQTS".equals(item.get("LXDY_KZSXID"))){
				queryParam.put("DXLBID", item.get("SXZ"));
				List<Map> dxsxzList =(List<Map>) getResultList("Q_SHGL_WS.GET_TB_SHGL_SHJBXX_KZSX_DXSXZ_BY_DXLBID", queryParam);    
				HashMap<Object,Map> tmpCache =new HashMap<Object,Map>(); 
				for(Map dxz : dxsxzList){
					Map obj=tmpCache.get(dxz.get("DXID"));
					if(obj==null){
						obj = new HashMap();
						tmpCache.put(dxz.get("DXID"), obj);
					} 
					obj.put(dxz.get("LXDY_KZSXID"), dxz.get("SXZ"));
				}
				List LIST_JQTS = new ArrayList();
				bo.put("LIST_JQTS", LIST_JQTS);
				for(Map obj:tmpCache.values()){
					HashMap o =new HashMap();
					o.put("JQJDID", bo.get("ID")); 
					o.put("TSMC", fmtValue(obj.get("JQTS_TSMC")));
					o.put("TSMS", fmtValue(obj.get("JQTS_TSMS"))); 
					
					LIST_JQTS.add(o);
				}
				
			} else if("JQJD_QTSS".equals(item.get("LXDY_KZSXID"))){
				queryParam.put("DXLBID", item.get("SXZ"));
				List<Map> dxsxzList =(List<Map>) getResultList("Q_SHGL_WS.GET_TB_SHGL_SHJBXX_KZSX_DXSXZ_BY_DXLBID", queryParam);    
				HashMap<Object,Map> tmpCache =new HashMap<Object,Map>(); 
				for(Map dxz : dxsxzList){
					Map obj=tmpCache.get(dxz.get("DXID"));
					if(obj==null){
						obj = new HashMap();
						tmpCache.put(dxz.get("DXID"), obj);
					} 
					obj.put(dxz.get("LXDY_KZSXID"), dxz.get("SXZ"));
				}
				List LIST_QTSS = new ArrayList();
				bo.put("LIST_QTSS", LIST_QTSS);
				for(Map obj:tmpCache.values()){
					HashMap o =new HashMap(); 
					
					o.put("JQJDID", bo.get("ID")); 
					o.put("SSMC", fmtValue(obj.get("QTSS_SSMC")));
					o.put("XXNR", fmtValue(obj.get("QTSS_XXNR"))); 
					o.put("YXSD", fmtValue(obj.get("QTSS_YXSD"))); 
				 
					LIST_QTSS.add(o);
				}
			} 
			
		}
		//列表——商户门面图片  
		List<Map> LIST_SHMM =(List<Map>) getResultList("Q_SHGL_WS.GET_TB_SHGL_SHMM_BY_SHID", queryParam);  
		List LIST_TP = new ArrayList();
		bo.put("LIST_TP", LIST_TP);
		for(Map item :LIST_SHMM){
			HashMap o =new HashMap();
			o.put("ID", item.get("ID"));
			o.put("JQJDID", bo.get("ID")); 
			o.put("XH",item.get("XH")); 
			o.put("TPSM",item.get("FILE_INFO")); 
			
			Map image =new HashMap();
			Map TB_UFM_UPLOADFILE = (Map) getServiceInterface().doService("SVC_UPLOADFILE", "GET_FILE_BY_ID", item.get("FILE_ID"));
		  
			o.put("TPLX", TB_UFM_UPLOADFILE.get("EXT_NAME"));
			o.put("TPID", item.get("FILE_ID"));
			o.put("TPML", image_path+JBXX.get("HYFLID"));
			
			image.put("ML", image_path+JBXX.get("HYFLID"));  
			image.put("LX", TB_UFM_UPLOADFILE.get("EXT_NAME"));
			image.put("ID", item.get("FILE_ID"));
			image.put("data", TB_UFM_UPLOADFILE.get("FILE_BODY"));
    		images.add(image); 
			LIST_TP.add(o); 
			
			//门面图片 
			if(item.get("FILE_ID")!=null&&item.get("FILE_ID").equals(JBXX.get("FILE_ID"))){ 
				bo.put("MMTP_LX", TB_UFM_UPLOADFILE.get("EXT_NAME"));
				bo.put("MMTP_ID", JBXX.get("FILE_ID"));
				bo.put("MMTP_ML", image_path+JBXX.get("HYFLID"));
			} 
		}
		  
		
		//列表—— 商品信息
		List<Map> spxxList = (List<Map>) getResultList( "Q_SHGL_WS.GET_TB_SHGL_SPXX_BY_SHID", queryParam);
		List<Map> LIST_SP = new ArrayList();
		bo.put("LIST_MP", LIST_SP);
		for(Map item:spxxList){ 
			HashMap o = new HashMap();
			o.put("ID", item.get("ID"));
			o.put("JQJDID", bo.get("ID"));
			o.put("MPLX", item.get("SPMC"));
			o.put("MPSM", item.get("SPJS"));
			o.put("MSJ", item.get("MSJ"));
			o.put("HYJ", item.get("XYJ"));
			o.put("ZK", item.get("HYZK")); 
			 
			LIST_SP.add(o); 
		}
		 
		//列表—— 周边交通 
		List<Map> JTFSList = (List<Map>) getResultList(  "SELECT new map(NAME AS NAME,CODE AS CODE) FROM TB_SYS_SJZD WHERE TYPE='TB_SHGL_ZBJT.JTFS'"); 
		Map cacheJTFS=new HashMap();
		for(Map item: JTFSList){
			cacheJTFS.put(item.get("CODE"), item.get("NAME"));
		}
		List<Map> QSDDList = (List<Map>) getResultList(  "SELECT new map(NAME AS NAME,CODE AS CODE) FROM TB_SYS_SJZD WHERE TYPE='TB_SHGL_ZBJT.QSDD'");
		Map cacheQSDD=new HashMap();
		for(Map item: QSDDList){
			cacheQSDD.put(item.get("CODE"), item.get("NAME"));
		}
		List<Map> LIST_ZBJT = new ArrayList<Map>();
		bo.put("LIST_ZBJT", LIST_ZBJT);
		List<Map> zbjtList = (List<Map>) getResultList(  "Q_SHGL_WS.GET_TB_SHGL_ZBJT_BY_SHID", queryParam);  
		for(Map item:zbjtList){ 
			HashMap o = new HashMap();
			o.put("ID", item.get("ID"));
			o.put("JQJDID", bo.get("ID"));
			o.put("QSDD", cacheQSDD.get(item.get("QSDD")));
			o.put("JTFS", cacheJTFS.get(item.get("JTFS")));
			o.put("XL", item.get("XL"));
			o.put("SJ", item.get("SJ"));  
		 
			LIST_ZBJT.add(o); 
		} 
		
		getServiceInterface().doService("SVC_RES", "SAVE_JQJD", bo);
		
		for(Map item:images){ 
			getServiceInterface().doService("SVC_RES", "SAVE_IMAGE", item.get("ML"), item.get("ID") , item.get("LX"), item.get("data"));
		}
    }
  //娱乐
    private void fb_yl(String  id,Map param,Map JBXX){
     	HashMap queryParam =new HashMap();
    	queryParam.put("SHID", id); 
    	Date optime = getOpTime(param);
    	String path_date = ObjectUtils.dateToString(optime, "yyyyMMdd");
    	String image_path = "images/shxx/"+path_date+"/";
    	List<Map> images=new ArrayList<Map>();
    	HashMap bo =new HashMap(); 
		copySysParam(param, bo);
		bo.put("ID", id);
		bo.put("SHMC", JBXX.get("SJMC"));
		bo.put("SHDZ", JBXX.get("XXDZ"));
		bo.put("SHJJ", JBXX.get("SHJJ"));  
		bo.put("TJDJ", JBXX.get("TJDJ"));
		bo.put("DQBM", JBXX.get("DQBM"));  
		
		
	 	//列表——商户扩展信息  
		List<Map> kzsxList =(List<Map>) getResultList("Q_SHGL_WS.GET_TB_SHGL_KZSXZ_BY_SHID", queryParam);  
		 
		for(Map item: kzsxList){
			if("YL_QTDH".equals(item.get("LXDY_KZSXID"))){
				bo.put("QTDH", item.get("SXZ")); 
			}else if("YL_YYSJ".equals(item.get("LXDY_KZSXID"))){
				bo.put("YYSJ", item.get("SXZ")); 
			}else if("YL_YYGM".equals(item.get("LXDY_KZSXID"))){
				bo.put("YYGM", item.get("SXZ")); 
			}else if("YL_TCQK".equals(item.get("LXDY_KZSXID"))){
				bo.put("TCQK", item.get("SXZ")); 
			}  
		}
		
		//列表——商户门面图片  
		List<Map> LIST_SHMM =(List<Map>) getResultList("Q_SHGL_WS.GET_TB_SHGL_SHMM_BY_SHID", queryParam);  
		List LIST_TP = new ArrayList();
		bo.put("LIST_TP", LIST_TP);
		for(Map item :LIST_SHMM){
			HashMap o =new HashMap();
			o.put("ID", item.get("ID"));
			o.put("YLID", bo.get("ID"));
			o.put("SYLXM","0");
			o.put("XH",item.get("XH")); 
			o.put("TPSM",item.get("FILE_INFO")); 
			
			Map image =new HashMap();
			Map TB_UFM_UPLOADFILE = (Map) getServiceInterface().doService("SVC_UPLOADFILE", "GET_FILE_BY_ID", item.get("FILE_ID"));
		  
			o.put("TPLX", TB_UFM_UPLOADFILE.get("EXT_NAME"));
			o.put("TPID", item.get("FILE_ID"));
			o.put("TPML", image_path+JBXX.get("HYFLID")); 
			
			image.put("ML", image_path+JBXX.get("HYFLID"));  
			image.put("LX", TB_UFM_UPLOADFILE.get("EXT_NAME"));
			image.put("ID", item.get("FILE_ID"));
			image.put("data", TB_UFM_UPLOADFILE.get("FILE_BODY"));
    		images.add(image); 
			LIST_TP.add(o);
			
			//门面图片 
			if(item.get("FILE_ID")!=null&&item.get("FILE_ID").equals(JBXX.get("FILE_ID"))){ 
				bo.put("MMTP_LX", TB_UFM_UPLOADFILE.get("EXT_NAME"));
				bo.put("MMTP_ID", JBXX.get("FILE_ID"));
				bo.put("MMTP_ML", image_path+JBXX.get("HYFLID"));
			} 
		}
		// 列表——商品图片 
	    List<Map> sp_images =(List<Map>) getResultList( "Q_SHGL_WS.GET_SPGL_SPXX_SPTP_BY_SPID", queryParam); 
	    for(Map item :sp_images){
			HashMap o =new HashMap();
			o.put("ID", item.get("ID"));
			o.put("YLID", bo.get("ID"));
			o.put("SYLXM","1");
			o.put("YLXMID",item.get("LINK_ID"));
			o.put("XH",item.get("XH")); 
			o.put("TPSM",item.get("FILE_INFO")); 
			
			Map image =new HashMap();
			Map TB_UFM_UPLOADFILE = (Map) getServiceInterface().doService("SVC_UPLOADFILE", "GET_FILE_BY_ID", item.get("FILE_ID"));
		  
			o.put("TPLX", TB_UFM_UPLOADFILE.get("EXT_NAME"));
			o.put("TPID", item.get("FILE_ID"));
			o.put("TPML", image_path+JBXX.get("HYFLID"));
			
			image.put("ML", image_path+JBXX.get("HYFLID"));  
			image.put("LX", TB_UFM_UPLOADFILE.get("EXT_NAME"));
			image.put("ID", item.get("FILE_ID"));
			image.put("data", TB_UFM_UPLOADFILE.get("FILE_BODY"));
    		images.add(image); 
			LIST_TP.add(o); 
			
		}
		
		
		//列表—— 商品信息
		List<Map> spxxList = (List<Map>) getResultList( "Q_SHGL_WS.GET_TB_SHGL_SPXX_BY_SHID", queryParam);
		List<Map> LIST_SP = new ArrayList();
		bo.put("LIST_SP", LIST_SP);
		for(Map item:spxxList){ 
			HashMap o = new HashMap();
			o.put("ID", item.get("ID"));
			o.put("YLID", bo.get("ID"));
			o.put("XMMC", item.get("SPMC"));
			o.put("JTJS", item.get("SPJS"));
			o.put("MSJ", item.get("MSJ"));
			o.put("HYJ", item.get("XYJ"));
			o.put("ZK", item.get("HYZK"));  
			 
			LIST_SP.add(o); 
		}
		 
		//列表—— 周边交通 
		List<Map> JTFSList = (List<Map>) getResultList(  "SELECT new map(NAME AS NAME,CODE AS CODE) FROM TB_SYS_SJZD WHERE TYPE='TB_SHGL_ZBJT.JTFS'"); 
		Map cacheJTFS=new HashMap();
		for(Map item: JTFSList){
			cacheJTFS.put(item.get("CODE"), item.get("NAME"));
		}
		List<Map> QSDDList = (List<Map>) getResultList(  "SELECT new map(NAME AS NAME,CODE AS CODE) FROM TB_SYS_SJZD WHERE TYPE='TB_SHGL_ZBJT.QSDD'");
		Map cacheQSDD=new HashMap();
		for(Map item: QSDDList){
			cacheQSDD.put(item.get("CODE"), item.get("NAME"));
		}
		List<Map> LIST_ZBJT = new ArrayList<Map>();
		bo.put("LIST_ZBJT", LIST_ZBJT);
		List<Map> zbjtList = (List<Map>) getResultList(  "Q_SHGL_WS.GET_TB_SHGL_ZBJT_BY_SHID", queryParam);  
		for(Map item:zbjtList){ 
			HashMap o = new HashMap();
			o.put("ID", item.get("ID"));
			o.put("YLID", bo.get("ID"));
			o.put("QSDD", cacheQSDD.get(item.get("QSDD")));
			o.put("JTFS", cacheJTFS.get(item.get("JTFS")));
			o.put("XL", item.get("XL"));
			o.put("SJ", item.get("SJ"));  
		 
			LIST_ZBJT.add(o); 
		} 
	
		getServiceInterface().doService("SVC_RES", "SAVE_YL", bo);
		
		for(Map item:images){ 
			getServiceInterface().doService("SVC_RES", "SAVE_IMAGE", item.get("ML"), item.get("ID") , item.get("LX"), item.get("data"));
		}
    }
  //购物
    private void fb_gw(String  id,Map param,Map JBXX){
    	HashMap queryParam =new HashMap();
    	queryParam.put("SHID", id); 
    	Date optime = getOpTime(param);
    	String path_date = ObjectUtils.dateToString(optime, "yyyyMMdd");
    	String image_path = "images/shxx/"+path_date+"/";
    	List<Map> images=new ArrayList<Map>();
    	HashMap bo =new HashMap(); 
		copySysParam(param, bo);
		bo.put("ID", id);
		bo.put("SHMC", JBXX.get("SJMC"));
		bo.put("SHDZ", JBXX.get("XXDZ"));
		bo.put("SHJJ", JBXX.get("SHJJ"));  
		bo.put("TJDJ", JBXX.get("TJDJ"));
		bo.put("DQBM", JBXX.get("DQBM"));  
		
	 	//列表——商户扩展信息  
		List<Map> kzsxList =(List<Map>) getResultList("Q_SHGL_WS.GET_TB_SHGL_KZSXZ_BY_SHID", queryParam);   
		for(Map item: kzsxList){
			if("GW_QTDH".equals(item.get("LXDY_KZSXID"))){
				bo.put("QTDH", item.get("SXZ")); 
			}else if("GW_YYSJ".equals(item.get("LXDY_KZSXID"))){
				bo.put("YYSJ", item.get("SXZ")); 
			}else if("GW_YYGM".equals(item.get("LXDY_KZSXID"))){
				bo.put("YYGM", item.get("SXZ")); 
			}else if("GW_TCQK".equals(item.get("LXDY_KZSXID"))){
				bo.put("XJ", item.get("SXZ")); 
			}
		}
		//列表——商户门面图片  
		List<Map> LIST_SHMM =(List<Map>) getResultList("Q_SHGL_WS.GET_TB_SHGL_SHMM_BY_SHID", queryParam);  
		List LIST_TP = new ArrayList();
		bo.put("LIST_TP", LIST_TP);
		for(Map item :LIST_SHMM){
			HashMap o =new HashMap();
			o.put("ID", item.get("ID"));
			o.put("GWID", bo.get("ID"));
			o.put("SSPTP","0");
			o.put("XH",item.get("XH")); 
			o.put("TPSM",item.get("FILE_INFO")); 
			
			Map image =new HashMap();
			Map TB_UFM_UPLOADFILE = (Map) getServiceInterface().doService("SVC_UPLOADFILE", "GET_FILE_BY_ID", item.get("FILE_ID"));
		  
			o.put("TPLX", TB_UFM_UPLOADFILE.get("EXT_NAME"));
			o.put("TPID", item.get("FILE_ID"));
			o.put("TPML", image_path+JBXX.get("HYFLID"));
			
			image.put("ML", image_path+JBXX.get("HYFLID"));  
			image.put("LX", TB_UFM_UPLOADFILE.get("EXT_NAME"));
			image.put("ID", item.get("FILE_ID"));
			image.put("data", TB_UFM_UPLOADFILE.get("FILE_BODY"));
    		images.add(image); 
			LIST_TP.add(o); 
			
			//门面图片 
			if(item.get("FILE_ID")!=null&&item.get("FILE_ID").equals(JBXX.get("FILE_ID"))){ 
				bo.put("MMTP_LX", TB_UFM_UPLOADFILE.get("EXT_NAME"));
				bo.put("MMTP_ID", JBXX.get("FILE_ID"));
				bo.put("MMTP_ML", image_path+JBXX.get("HYFLID"));
			} 
		}
		// 列表——商品图片 
	    List<Map> sp_images =(List<Map>) getResultList( "Q_SHGL_WS.GET_SPGL_SPXX_SPTP_BY_SPID", queryParam); 
	    for(Map item :sp_images){
			HashMap o =new HashMap();
			o.put("ID", item.get("ID"));
			o.put("GWID", bo.get("ID"));
			o.put("SSPTP","1");
			o.put("SPID",item.get("LINK_ID"));
			o.put("XH",item.get("XH")); 
			o.put("TPSM",item.get("FILE_INFO")); 
			
			Map image =new HashMap();
			Map TB_UFM_UPLOADFILE = (Map) getServiceInterface().doService("SVC_UPLOADFILE", "GET_FILE_BY_ID", item.get("FILE_ID"));
		  
			o.put("TPLX", TB_UFM_UPLOADFILE.get("EXT_NAME"));
			o.put("TPID", item.get("FILE_ID"));
			o.put("TPML", image_path+JBXX.get("HYFLID"));
			
			image.put("ML", image_path+JBXX.get("HYFLID"));  
			image.put("LX", TB_UFM_UPLOADFILE.get("EXT_NAME"));
			image.put("ID", item.get("FILE_ID"));
			image.put("data", TB_UFM_UPLOADFILE.get("FILE_BODY"));
    		images.add(image); 
			LIST_TP.add(o);
		}
		
		
		//列表—— 商品信息
		List<Map> spxxList = (List<Map>) getResultList( "Q_SHGL_WS.GET_TB_SHGL_SPXX_BY_SHID", queryParam);
		List<Map> LIST_SP = new ArrayList();
		bo.put("LIST_SP", LIST_SP);
		for(Map item:spxxList){ 
			HashMap o = new HashMap();
			o.put("ID", item.get("ID"));
			o.put("GWID", bo.get("ID"));
			o.put("SPMC", item.get("SPMC"));
			o.put("JTJS", item.get("SPJS"));
			o.put("MSJ", item.get("MSJ"));
			o.put("HYJ", item.get("XYJ"));
			o.put("ZK", item.get("HYZK")); 
			 
			LIST_SP.add(o); 
		}
		 
		//列表—— 周边交通 
		List<Map> JTFSList = (List<Map>) getResultList(  "SELECT new map(NAME AS NAME,CODE AS CODE) FROM TB_SYS_SJZD WHERE TYPE='TB_SHGL_ZBJT.JTFS'"); 
		Map cacheJTFS=new HashMap();
		for(Map item: JTFSList){
			cacheJTFS.put(item.get("CODE"), item.get("NAME"));
		}
		List<Map> QSDDList = (List<Map>) getResultList(  "SELECT new map(NAME AS NAME,CODE AS CODE) FROM TB_SYS_SJZD WHERE TYPE='TB_SHGL_ZBJT.QSDD'");
		Map cacheQSDD=new HashMap();
		for(Map item: QSDDList){
			cacheQSDD.put(item.get("CODE"), item.get("NAME"));
		}
		List<Map> LIST_ZBJT = new ArrayList<Map>();
		bo.put("LIST_ZBJT", LIST_ZBJT);
		List<Map> zbjtList = (List<Map>) getResultList(  "Q_SHGL_WS.GET_TB_SHGL_ZBJT_BY_SHID", queryParam);  
		for(Map item:zbjtList){ 
			HashMap o = new HashMap();
			o.put("ID", item.get("ID"));
			o.put("GWID", bo.get("ID"));
			o.put("QSDD", cacheQSDD.get(item.get("QSDD")));
			o.put("JTFS", cacheJTFS.get(item.get("JTFS")));
			o.put("XL", item.get("XL"));
			o.put("SJ", item.get("SJ"));  
		 
			LIST_ZBJT.add(o); 
		} 
		
		getServiceInterface().doService("SVC_RES", "SAVE_GW", bo);
		
		for(Map item:images){ 
			getServiceInterface().doService("SVC_RES", "SAVE_IMAGE", item.get("ML"), item.get("ID") , item.get("LX"), item.get("data"));
		}
		
    }
  //机票代理
    private void fb_jpdl(String  id,Map param,Map JBXX){
    	HashMap queryParam =new HashMap();
    	queryParam.put("SHID", id); 
    	Date optime = getOpTime(param);
    	String path_date = ObjectUtils.dateToString(optime, "yyyyMMdd");
    	String image_path = "images/shxx/"+path_date+"/";
    	List<Map> images=new ArrayList<Map>();
    	HashMap bo =new HashMap(); 
		copySysParam(param, bo);
		bo.put("ID", id);
		bo.put("SHMC", JBXX.get("SJMC"));
		bo.put("SHDZ", JBXX.get("XXDZ"));
		bo.put("SHJJ", JBXX.get("SHJJ"));  
		bo.put("TJDJ", JBXX.get("TJDJ"));
		bo.put("DQBM", JBXX.get("DQBM"));  
		
		
	 	//列表——商户扩展信息  
		List<Map> kzsxList =(List<Map>) getResultList("Q_SHGL_WS.GET_TB_SHGL_KZSXZ_BY_SHID", queryParam);   
		for(Map item: kzsxList){
			if("JPDL_DPDH".equals(item.get("LXDY_KZSXID"))){
				bo.put("DPDH", fmtValue(item.get("SXZ"))); 
			}else if("JPDL_CPDQ_GN".equals(item.get("LXDY_KZSXID"))){
				bo.put("CPDQ_GN", fmtValue(item.get("SXZ"))); 
			}else if("JPDL_CPDQ_GJ".equals(item.get("LXDY_KZSXID"))){
				bo.put("CPDQ_GJ", fmtValue(item.get("SXZ"))); 
			}else if("JPDL_SPQY".equals(item.get("LXDY_KZSXID"))){
				bo.put("SPQY", fmtValue(item.get("SXZ"))); 
			}else if("JPDL_FYBZ".equals(item.get("LXDY_KZSXID"))){
				bo.put("FYBZ", fmtValue(item.get("SXZ"))); 
			} 
		}
		
		//列表——商户门面图片  
		List<Map> LIST_SHMM =(List<Map>) getResultList("Q_SHGL_WS.GET_TB_SHGL_SHMM_BY_SHID", queryParam);  
		List LIST_TP = new ArrayList();
		bo.put("LIST_TP", LIST_TP);
		for(Map item :LIST_SHMM){
			HashMap o =new HashMap();
			o.put("ID", item.get("ID"));
			o.put("JPDLID", bo.get("ID"));
			 
			o.put("XH",item.get("XH")); 
			o.put("TPSM",item.get("FILE_INFO")); 
			
			Map image =new HashMap();
			Map TB_UFM_UPLOADFILE = (Map) getServiceInterface().doService("SVC_UPLOADFILE", "GET_FILE_BY_ID", item.get("FILE_ID"));
		  
			o.put("TPLX", TB_UFM_UPLOADFILE.get("EXT_NAME"));
			o.put("TPID", item.get("FILE_ID"));
			o.put("TPML", image_path+JBXX.get("HYFLID")); 
			
			image.put("ML", image_path+JBXX.get("HYFLID"));  
			image.put("LX", TB_UFM_UPLOADFILE.get("EXT_NAME"));
			image.put("ID", item.get("FILE_ID"));
			image.put("data", TB_UFM_UPLOADFILE.get("FILE_BODY"));
    		images.add(image); 
			LIST_TP.add(o);
			
			//门面图片 
			if(item.get("FILE_ID")!=null&&item.get("FILE_ID").equals(JBXX.get("FILE_ID"))){ 
				bo.put("MMTP_LX", TB_UFM_UPLOADFILE.get("EXT_NAME"));
				bo.put("MMTP_ID", JBXX.get("FILE_ID"));
				bo.put("MMTP_ML", image_path+JBXX.get("HYFLID"));
			} 
		} 
	
		getServiceInterface().doService("SVC_RES", "SAVE_JPDL", bo);
		
		for(Map item:images){ 
			getServiceInterface().doService("SVC_RES", "SAVE_IMAGE", item.get("ML"), item.get("ID") , item.get("LX"), item.get("data"));
		}
    }
  
    private void fb(String  id,Map param){ 
    	HashMap queryParam =new HashMap();
    	queryParam.put("SHID", id);  
     
		//对象——商户基本信息  
		Map JBXX = (Map) querySingleResult("Q_SHGL_WS.GET_TB_SHGL_JBXX_BY_SHID",queryParam);  
    	 
    	if("01".equals(JBXX.get("HYFLID"))){
    		 //餐饮
    		fb_cy(id,param,JBXX);
    	}else if("02".equals(JBXX.get("HYFLID"))){
    		//酒店
    		fb_jd(id,param,JBXX);
    	}else if("03".equals(JBXX.get("HYFLID"))){
    		//交通租车行
    		fb_zch(id,param,JBXX);
    	}else if("04".equals(JBXX.get("HYFLID"))){
    		//景区、景点
    		fb_jqjd(id,param,JBXX);
    	}else if("05".equals(JBXX.get("HYFLID"))){
    		//娱乐
    		fb_yl(id,param,JBXX);
    	}else if("06".equals(JBXX.get("HYFLID"))){
    		//购物
    		fb_gw(id,param,JBXX);
    	}else if("07".equals(JBXX.get("HYFLID"))){
    		//机票代理
    		fb_jpdl(id,param,JBXX);
    	}
    }
    private Map  getValueMap(String str){ 
    	Map<String,String> map=new HashMap<String,String>();
    	for(String v : str.split(",")){
    		String[] aV=v.split("=");
    		if(aV.length==1){
    			map.put(aV[0], aV[0]);
    		}else{
    			map.put(aV[0], aV[1]);
    		} 
    	}
    
    	return map;
    }
    
   

}
